package com.majx.service.impl;

import com.majx.mapper.ArtifactMapper;
import com.majx.pojo.Artifact;
import com.majx.service.ArtifactService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArtifactServiceImpl implements ArtifactService {
    private ArtifactMapper artifactMapper;

    public void setArtifactMapper(ArtifactMapper artifactMapper) {
        this.artifactMapper = artifactMapper;
    }

    /**
     * 查询分页文物
     * @param startRow
     * @return
     */
    public List<Artifact> queryArtPage(Integer startRow) {
        return artifactMapper.queryArtPage(startRow);
    }

    /**
     * 查询分页文物--带条件
     * @param startRow
     * @param artId
     * @param artName
     * @return
     */
    public List<Artifact> selectArtPage(Integer startRow, Integer artId, String artName) {
        return artifactMapper.selectArtPage(startRow,artId,artName);
    }

    /**
     * 添加文物
     * @param artifact
     * @return
     */
    public Integer addArt(Artifact artifact) {
        return artifactMapper.addArt(artifact);
    }

    /**
     * 删除文物
     * @param artId
     * @return
     */
    public Integer deleteArt(Integer artId) {
        return artifactMapper.deleteArt(artId);
    }


    /**
     * 批量删除文物
     * @param idList
     * @return
     */
    public Integer deleteArtList(List<Integer> idList) {
        return artifactMapper.deleteArtList(idList);
    }

    /**
     * 更新文物
     * @param artifact
     * @return
     */
    public Integer updateArt(Artifact artifact){
        return artifactMapper.updateArt(artifact);
    }


    /**
     * 获取文物总数
     * @return
     */
    public Integer getArtCount(Integer artId, String artName) {
        return artifactMapper.getArtCount(artId,artName);
    }
}
